package com.vrp3d.service;

import com.vrp3d.common.response.RestResponse;
import com.vrp3d.domain.dto.user.UserForChangePasswordDTO;
import com.vrp3d.domain.dto.user.UserForLoginDTO;
import com.vrp3d.domain.dto.user.UserForRecoverPasswordDTO;
import com.vrp3d.domain.dto.user.UserForRegisteredDTO;
import com.vrp3d.domain.po.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 用户
 *
 * @author vrp3d
 */
public interface UserService extends AbsService {

    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    User selectByPrimaryKey(Integer id);

    /**
     * 根据手机号查询
     *
     * @param mobile
     * @return
     */
    User findByMobile(String mobile);

    /**
     * 根据email查询
     *
     * @param email
     * @return
     */
    User findByEmail(String email);

    /**
     * 根据用户名查询
     *
     * @param username
     * @return
     */
    User findByUsername(String username);

    /**
     * 登录,手机号/邮箱
     *
     * @param user
     * @param request
     * @param response
     * @return
     */
    String login(UserForLoginDTO user, HttpServletRequest request, HttpServletResponse response);

    /**
     * 退出登录
     */
    void logout();

    /**
     * 注册
     *
     * @param user
     */
    void registered(UserForRegisteredDTO user);

    /**
     * 注册时,获取手机验证码
     *
     * @param mobile
     */
    void getPhoneVerificationCodeWhenRegistering(String mobile);

    /**
     * 手机号找回密码,发送验证码
     *
     * @param mobile
     * @return
     */
    RestResponse getRecoverPasswordVerificationCode(String mobile);

    /**
     * 找回密码
     *
     * @param user
     */
    void recoverPassword(UserForRecoverPasswordDTO user);

    /**
     * 修改密码
     *
     * @param user
     */
    void changePassword(UserForChangePasswordDTO user);
}
